import 'dart:io';

import 'package:flutter/material.dart';

import '../../ble/protocol/iledcolor/source/graffiti/GraffitiSourceBean.dart';

class ShowGraffitiSourceWidget extends StatelessWidget {
  final GraffitiSourceBean sourceBean;

  const ShowGraffitiSourceWidget({super.key, required this.sourceBean});

  ImageProvider getImageProvider() {
    if (sourceBean.imagePath.isNotEmpty) {
      return FileImage(File(sourceBean.imagePath));
    } else {
      return sourceBean.memoryImage;
    }
  }

  @override
  Widget build(BuildContext context) {
    return Image(image: getImageProvider(), filterQuality: FilterQuality.none, fit: BoxFit.contain);
  }
}
